//
//  UIView+RX.swift
//  mmda
//
//  Created by 李陆涛 on 2018/5/16.
//  Copyright © 2018年 mmda. All rights reserved.
//

import RxSwift
import RxCocoa
import UIKit
import Toast_Swift

extension Reactive where Base: UIView {
    
    
    var showToast: Binder<String?> {
        
        return Binder(base) {
            view, str in

            guard let str = str else {return}
            
            if  str.count > 0 {
                view.makeToast(str, position: .center)
            }
        }
    }
    
    var showToastActivity: Binder<Bool> {
        
        return Binder(base) {
            
            view, show in
            
            if show {
                view.makeToastActivity(.center)
            } else {
                view.hideToastActivity()
            }
        }
    }
}

